﻿using System;
using System.Collections.Generic;
using Lightray.Hattrick.ChppLib.EntityTypes;

namespace Lightray.Hattrick.ChppLib
{
    public class Currency
    {
        #region Country -> Hattrick currency rate Map
        private static Dictionary<Country, float> COUNTRY_TO_CURRENCY_RATE_MAP = new Dictionary<Country, float>()
        {
            { Country.Sweden, 1f },
            { Country.England, 15f },
            { Country.Germany, 10f },
            { Country.Italy, 10f },
            { Country.France, 10f },
            { Country.Mexico, 1f },
            { Country.Argentina, 10f },
            { Country.USA, 10f },
            { Country.Norway, 1f },
            { Country.Denmark, 1f },
            { Country.Finland, 10f },
            { Country.Netherlands, 10f },
            { Country.Oceania, 5f },
            { Country.Brazil, 5f },
            { Country.Canada, 5f },
            { Country.Chile, 50f },
            { Country.Colombia, 10f },
            { Country.India, 0.25f },
            { Country.Ireland, 10f },
            { Country.Japan, 0.1f },
            { Country.Peru, 10f },
            { Country.Poland, 2.5f },
            { Country.Portugal, 10f },
            { Country.Scotland, 15f },
            { Country.SouthAfrica, 1.25f },
            { Country.Uruguay, 1f },
            { Country.Venezuela, 10f },
            { Country.SouthKorea, 10f },
            { Country.Thailand, 0.25f },
            { Country.Turkey, 10f },
            { Country.Egypt, 2.5f },
            { Country.China, 1f },
            { Country.Russia, 0.25f },
            { Country.Spain, 10f },
            { Country.Romania, 0.5f },
            { Country.Iceland, 0.1f },
            { Country.Austria, 10f },
            { Country.Belgium, 10f },
            { Country.Malaysia, 2.5f },
            { Country.Switzerland, 5f },
            { Country.Singapore, 5f },
            { Country.Greece, 10f },
            { Country.Hungary, 50f },
            { Country.CzechRepublic, 0.25f },
            { Country.Latvia, 20f },
            { Country.Indonesia, 1f },
            { Country.Philippines, 0.25f },
            { Country.Estonia, 10f },
            { Country.Serbia, 1f },
            { Country.Croatia, 1f },
            { Country.HongKong, 1f },
            { Country.ChineseTaipei, 10f },
            { Country.Wales, 15f },
            { Country.Bulgaria, 5f },
            { Country.Israel, 2f },
            { Country.Slovenia, 10f },
            { Country.Lithuania, 2.5f },
            { Country.Slovakia, 10f },
            { Country.Ukraine, 2f },
            { Country.BosniaHerzegovina, 5f },
            { Country.Vietnam, 1f },
            { Country.Pakistan, 0.2f },
            { Country.Paraguay, 2f },
            { Country.Ecuador, 10f },
            { Country.Bolivia, 1f },
            { Country.Nigeria, 0.1f },
            { Country.FaroeIslands, 1f },
            { Country.Morocco, 1f },
            { Country.SaudiArabia, 2.5f },
            { Country.Tunisia, 8f },
            { Country.CostaRica, 0.2f },
            { Country.UnitedArabEmirates, 4f },
            { Country.Luxembourg, 10f },
            { Country.Iran, 1f },
            { Country.DominicanRepublic, 0.5f },
            { Country.Cyprus, 10f },
            { Country.Belarus, 5f },
            { Country.NorthernIreland, 15f },
            { Country.Jamaica, 0.5f },
            { Country.Kenya, 0.5f },
            { Country.Panama, 10f },
            { Country.FYRMacedonia, 0.5f },
            { Country.Albania, 50f },
            { Country.Honduras, 5f },
            { Country.ElSalvador, 10f },
            { Country.Malta, 10f },
            { Country.Kyrgyzstan, 0.2f },
            { Country.Moldova, 0.5f },
            { Country.Georgia, 5f },
            { Country.Andorra, 10f },
            { Country.Jordan, 5f },
            { Country.Guatemala, 10f },
            { Country.TrinidadTobago, 1f },
            { Country.Nicaragua, 0.5f },
            { Country.Kazakhstan, 0.1f },
            { Country.Suriname, 5f },
            { Country.Liechtenstein, 5f },
            { Country.Algeria, 0.1f },
            { Country.Mongolia, 5f },
            { Country.Lebanon, 5f },
            { Country.Senegal, 20f },
            { Country.Armenia, 20f },
            { Country.Bahrain, 20f },
            { Country.Barbados, 5f },
            { Country.CapeVerde, 0.1f },
            { Country.IvoryCoast, 20f },
            { Country.Kuwait, 25f },
            { Country.Iraq, 5f },
            { Country.Azerbaijan, 10f },
            { Country.Angola, 0.1f },
            { Country.Montenegro, 10f },
            { Country.Bangladesh, 0.2f },
            { Country.Yemen, 0.1f },
            { Country.Oman, 20f },
            { Country.Mozambique, 0.4f },
            { Country.Brunei, 5f },
            { Country.Ghana, 10f },
            { Country.Cambodia, 0.0025f },
            { Country.Benin, 10f },
            { Country.Syria, 10f },
            { Country.Qatar, 10f },
            { Country.Tanzania, 10f },
            { Country.Uganda, 5f },
            { Country.Maldives, 0.5f },
            { Country.Uzbekistan, 10f },
            { Country.Cameroon, 20f },
            { Country.Cuba, 10f },
            { Country.Palestine, 2f },
        };
        #endregion

        #region Country -> Currency symbol
        private static Dictionary<Country, string> COUNTRY_TO_CURRENCY_SYMBOL_MAP = new Dictionary<Country, string>()
        {
            { Country.Sweden, "kr" },
            { Country.England, "£" },
            { Country.Germany, "€" },
            { Country.Italy, "€" },
            { Country.France, "€" },
            { Country.Mexico, "$" },
            { Country.Argentina, "$" },
            { Country.USA, "$" },
            { Country.Norway, "kr" },
            { Country.Denmark, "kr" },
            { Country.Finland, "€" },
            { Country.Netherlands, "€" },
            { Country.Oceania, "$" },
            { Country.Brazil, "R$" },
            { Country.Canada, "$" },
            { Country.Chile, "$" },
            { Country.Colombia, "$" },
            { Country.India, "रु" },
            { Country.Ireland, "€" },
            { Country.Japan, "¥" },
            { Country.Peru, "S/." },
            { Country.Poland, "zł" },
            { Country.Portugal, "€" },
            { Country.Scotland, "£" },
            { Country.SouthAfrica, "R" },
            { Country.Uruguay, "$U" },
            { Country.Venezuela, "Bs" },
            { Country.SouthKorea, "₩" },
            { Country.Thailand, "฿" },
            { Country.Turkey, "TL" },
            { Country.Egypt, "ج.م.‏" },
            { Country.China, "￥" },
            { Country.Russia, "р." },
            { Country.Spain, "€" },
            { Country.Romania, "lei" },
            { Country.Iceland, "kr." },
            { Country.Austria, "€" },
            { Country.Belgium, "€" },
            { Country.Malaysia, "R" },
            { Country.Switzerland, "SFr." },
            { Country.Singapore, "$" },
            { Country.Greece, "€" },
            { Country.Hungary, "Ft" },
            { Country.CzechRepublic, "Kč" },
            { Country.Latvia, "Ls" },
            { Country.Indonesia, "Rp" },
            { Country.Philippines, "Php" },
            { Country.Estonia, "kr" },
            { Country.Serbia, "dinar" },
            { Country.Croatia, "kn" },
            { Country.HongKong, "HK$" },
            { Country.ChineseTaipei, "NT$" },
            { Country.Wales, "£" },
            { Country.Bulgaria, "лв" },
            { Country.Israel, "₪" },
            { Country.Slovenia, "€" },
            { Country.Lithuania, "Lt" },
            { Country.Slovakia, "€" },
            { Country.Ukraine, "грн." },
            { Country.BosniaHerzegovina, "KM" },
            { Country.Vietnam, "₫" },
            { Country.Pakistan, "Rs" },
            { Country.Paraguay, "Gs" },
            { Country.Ecuador, "$" },
            { Country.Bolivia, "$b" },
            { Country.Nigeria, "kNaira" },
            { Country.FaroeIslands, "kr" },
            { Country.Morocco, "د.م.‏" },
            { Country.SaudiArabia, "ر.س.‏" },
            { Country.Tunisia, "د.ت.‏" },
            { Country.CostaRica, "₡" },
            { Country.UnitedArabEmirates, "د.إ.‏" },
            { Country.Luxembourg, "€" },
            { Country.Iran, "ريال" },
            { Country.DominicanRepublic, "RD$" },
            { Country.Cyprus, "€" },
            { Country.Belarus, "р." },
            { Country.NorthernIreland, "£" },
            { Country.Jamaica, "J$" },
            { Country.Kenya, "S" },
            { Country.Panama, "B/." },
            { Country.FYRMacedonia, "ден." },
            { Country.Albania, "Lek" },
            { Country.Honduras, "L." },
            { Country.ElSalvador, "$" },
            { Country.Malta, "€" },
            { Country.Kyrgyzstan, "сом" },
            { Country.Moldova, "lei" },
            { Country.Georgia, "Lari" },
            { Country.Andorra, "€" },
            { Country.Jordan, "د.ا.‏" },
            { Country.Guatemala, "Q" },
            { Country.TrinidadTobago, "TT$" },
            { Country.Nicaragua, "C$" },
            { Country.Kazakhstan, "Т" },
            { Country.Suriname, "SRD" },
            { Country.Liechtenstein, "CHF" },
            { Country.Algeria, "د.ج.‏" },
            { Country.Mongolia, "₮" },
            { Country.Lebanon, "ل.ل.‏" },
            { Country.Senegal, "000 XOF" },
            { Country.Armenia, "դր." },
            { Country.Bahrain, "د.ب.‏" },
            { Country.Barbados, "BBD" },
            { Country.CapeVerde, "Esc." },
            { Country.IvoryCoast, "000 XOF" },
            { Country.Kuwait, "د.ك.‏" },
            { Country.Iraq, "د.ع.‏" },
            { Country.Azerbaijan, "ман." },
            { Country.Angola, "kwanza" },
            { Country.Montenegro, "€" },
            { Country.Bangladesh, "taka" },
            { Country.Yemen, "ر.ي.‏" },
            { Country.Oman, "ر.ع.‏" },
            { Country.Mozambique, "metical" },
            { Country.Brunei, "$" },
            { Country.Ghana, "cedis" },
            { Country.Cambodia, "Riel" },
            { Country.Benin, "$" },
            { Country.Syria, "ل.س.‏" },
            { Country.Qatar, "ر.ق.‏" },
            { Country.Tanzania, "$" },
            { Country.Uganda, "000 shill" },
            { Country.Maldives, "ރ." },
            { Country.Uzbekistan, "сўм" },
            { Country.Cameroon, "000 XAF" },
            { Country.Cuba, "$" },
            { Country.Palestine, "NIS" },
        };
        #endregion

        public static float GetRate(Country c)
        {
            if (COUNTRY_TO_CURRENCY_RATE_MAP.ContainsKey(c))
                return COUNTRY_TO_CURRENCY_RATE_MAP[c];

            throw new ArgumentException("Invalid country value", "c");
        }

        public static string GetSymbol(Country c)
        {
            if (COUNTRY_TO_CURRENCY_SYMBOL_MAP.ContainsKey(c))
                return COUNTRY_TO_CURRENCY_SYMBOL_MAP[c];

            throw new ArgumentException("Invalid country value", "c");
        }
    }
}
